#ifndef WAITINGWIDGET_H
#define WAITINGWIDGET_H

#include <QLabel>
#include <QPen>

class QTimer;

class WaitingWidget : public QLabel
{
    Q_OBJECT
public:
    explicit WaitingWidget(QWidget *parent = 0);

    bool isRunning() const;

public slots:
    void setStartAngle (double startAngle, bool updateNow = true);
    void setEndAngle (double endAngle, bool updateNow = true);
    void setStartColor (QColor color, bool updateNow = true);
    void setEndColor (QColor color, bool updateNow = true);
    void setSpeed (double speed);
    void startAnimation();
    void stopAnimation();
    void setPixmap(const QPixmap &pixmap);
    void setText(const QString &text);
    void clear();

protected:
    void updateGradient();
    virtual void paintEvent (QPaintEvent *event);

    QTimer* m_timer;
    QPen m_pen;
    double m_rotation;
    double m_speed;
    double m_startAngle;
    double m_endAngle;
    double m_gradientStartPoint;
    double m_gradientEndPoint;
    double m_arcStartAngle;
    double m_arcEndAngle;
    QColor m_gradientStartColor;
    QColor m_gradientEndColor;
};

#endif // WAITINGWIDGET_H
